Skip to content

Instantly share code, notes, and snippets.

View emacs-snapshot.sh
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt install build-essential libgtk-3-dev libgnutls28-dev libtiff5-dev libgif-dev libjpeg-dev libpng-dev libxpm-dev libncurses-dev texinfo \
libjansson4 libjansson-dev \
libgccjit0 libgccjit-11-dev gcc-11 g++-11
./autogen.sh
export CC=/usr/bin/gcc-11 CXX=/usr/bin/gcc-11
./configure --with-native-compilation --with-json --with-pgtk
make -j8
sudo make install
@alexedwards
alexedwards / Makefile
Created May 2, 2023 16:04
Makefile targets for working with sqlite
View Makefile
## db/connect: create to the local database
.PHONY: db/connect
db/connect:
sqlite3 db.sqlite
## db/migrations/new name=$1: create a new migration
.PHONY: db/migrations/new
db/migrations/new:
go run -tags 'sqlite3' github.com/golang-migrate/migrate/v4/cmd/migrate@latest create -seq -ext=.sql -dir=./resources/migrations ${name}
@pesterhazy
pesterhazy / building-sync-systems.md
Last active September 8, 2023 10:51
Building an offline realtime sync engine
View building-sync-systems.md

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

@TengdaHan
TengdaHan / ddp_notes.md
Last active September 8, 2023 10:50
Multi-node-training on slurm with PyTorch
View ddp_notes.md

Multi-node-training on slurm with PyTorch

What's this?

  • A simple note for how to start multi-node-training on slurm scheduler with PyTorch.
  • Useful especially when scheduler is too busy that you cannot get multiple GPUs allocated, or you need more than 4 GPUs for a single job.
  • Requirement: Have to use PyTorch DistributedDataParallel(DDP) for this purpose.
  • Warning: might need to re-factor your own code.
  • Warning: might be secretly condemned by your colleagues because using too many GPUs.
View Open Chrome without framerate limit
# Unix (Terminal)
open -a "Google Chrome" --args --disable-gpu-vsync --disable-frame-rate-limit
# Windows (Command prompt)
start chrome --args --disable-gpu-vsync --disable-frame-rate-limit
@jmreynolds
jmreynolds / BulkInsertAll.cs
Last active September 8, 2023 10:48 — forked from oshea00/BulkInsertAll.cs
Use SQLBulkLoad with linq-toSQL in LinqPad
View BulkInsertAll.cs
// Add this to LinqPad "C# Program"
// Example use:
// Insead of this: (create a List<CS_POSITION>)
// CS_POSITIONs.InsertOnSubmit(position);
// This:
// positions.Add(position);
//
// Then instead of this:
// SubmitChanges()
// This:
@tmsperera
tmsperera / evaluation-reset.sh
Last active September 8, 2023 10:48
JetBrains reset trial evaluation for Linux
View evaluation-reset.sh
for product in IntelliJIdea WebStorm DataGrip PhpStorm CLion PyCharm GoLand RubyMine; do
echo "Resetting trial period for $product"
echo "removing evaluation key..."
rm -rf ~/.config/$product*/eval
# Above path not working on latest version. Fixed below
rm -rf ~/.config/JetBrains/$product*/eval
echo "removing all evlsprt properties in options.xml..."
@kevinkindom
kevinkindom / Python Socket 编程详细介绍.md
Last active September 8, 2023 10:48
Python Socket 编程详细介绍
View Python Socket 编程详细介绍.md

Python Socket 编程详细介绍

Python 提供了两个基本的 socket 模块:

  • Socket 它提供了标准的BSD Socket API。
  • SocketServer 它提供了服务器重心,可以简化网络服务器的开发。

下面讲解下 Socket模块功能。

Socket 类型

@LaurentDevUp
LaurentDevUp / hello.c
Last active September 8, 2023 10:47
mon hello world
View hello.c
int main()
{
printf("hello world");
return 0;
}
@phillipwilhelm
phillipwilhelm / gist:048191a6411f9093d8f4879d9e991def
Created September 4, 2017 17:57
Gravity Forms - API Email Validation for FIELD
View gist:048191a6411f9093d8f4879d9e991def
// Email validation by third-party API
// The following example shows how you can send the value of an Email type field to a third-party API to determine if the email is valid. In this example we are using the QuickEmailVerification API.
add_filter( 'gform_field_validation', function ( $result, $value, $form, $field ) {
if ( $field->get_input_type() === 'email' && $result['is_valid'] ) {
$request_url = add_query_arg(
array(
'email' => $value,
'apikey' => 'your_api_key_here',