Skip to content

Instantly share code, notes, and snippets.

View shimondoodkin's full-sized avatar

Shimon Doodkin shimondoodkin

View GitHub Profile
@eatonphil
eatonphil / psql-srv.py
Last active April 28, 2024 09:26 — forked from matteobertozzi/psql-srv.py
postgres "server" wire protocol example (ported python3)
# th30z@u1310:[Desktop]$ psql -h localhost -p 55432
# Password:
# psql (9.1.10, server 0.0.0)
# WARNING: psql version 9.1, server version 0.0.
# Some psql features might not work.
# Type "help" for help.
#
# th30z=> select foo;
# a | b
# ---+---
@yuval-a
yuval-a / gist:ad8dd131506c56da2a634693db72e2c9
Last active April 19, 2021 08:15
str_length that ignores Hebrew "nikud" characters
function str_length(str) {
let length = 0, nikud_chars = /[ְֱֲֳִֵֶַָֹֻּׁׂ]/;
for (let i=0,len=str.length;i<len;i++)
length += nikud_chars.test(str[i]) ? 0 : 1;
return length;
}
@aniongithub
aniongithub / CMakeLists.txt
Last active June 26, 2019 19:40
Building native Node.js modules with node-cmake, nbind and conan
cmake_minimum_required(VERSION 3.1)
project(nbind VERSION 1.0.0)
add_definitions(-DBUILDING_NODE_EXTENSION)
add_definitions(-DUSING_V8_SHARED)
add_definitions(-DUSING_UV_SHARED)
add_definitions(-DV8_DEPRECATION_WARNINGS)
include(node_modules/node-cmake/NodeJS.cmake)
@kidapu
kidapu / root-ro
Last active April 28, 2020 04:09 — forked from sbonfert/root-ro
Read-only Root-FS with overlayfs for Raspian
#!/bin/sh
#
# Read-only Root-FS for Raspian
#
# Modified 2016 by Stefan Bonfert to make it compatible with Raspbian
# Jessie (vanilla).
#
# Modified 2015 by Pascal Rosin to work on raspian-ua-netinst with
# overlayfs integrated in Linux Kernel >= 3.18.
#
#!/usr/bin/env python
"""Translate text_to_translate using microsoft translator service."""
import json
import xml.etree.ElementTree as etree
try:
from urllib import urlencode
from urllib2 import urlopen, Request
except ImportError: # Python 3
from urllib.parse import urlencode
from urllib.request import urlopen, Request
// (c) copyright unscriptable.com / John Hann | LegendLee
// License MIT
// For more robust promises, see https://github.com/briancavalier/when.js.
// last edited by LegendLee(legendlee1314@gmail.com)
function Promise() {
this._thens = [];
}
Promise.prototype = {
@jacknab
jacknab / gist:4026553
Created November 6, 2012 18:28 — forked from strangerstudios/gist:1389944
Paid Memberships Pro Extra Checkout/Profile Fields Example
<?php
/*
Adding First and Last Name to Checkout Form
*/
//add the fields to the form
function my_pmpro_checkout_after_password()
{
if(!empty($_REQUEST['firstname']))
$firstname = $_REQUEST['firstname'];
@adammw
adammw / README.md
Created August 3, 2012 06:30
Node.js for Raspberry Pi

Node.js for Raspberry Pi

Pre-built binaries

Recent releases have been pre-built using cross-compilers and this script and are downloadable below.

If you have found these packages useful, give me a shout out on twitter: @adammw

@andrewdeandrade
andrewdeandrade / app.js
Created June 29, 2012 18:19
Node.js ('child_process').spawn bug with SSH
var spawn = require('child_process').spawn
var instance = {
ipAddress: "0.0.0.0"
};
var awsPreSharedKeyPath = '~/.ssh/aws-preshared-key.pem'; // make sure key has permissions 600 with chmod
var spawnArgs = [ '-tt', // force teletype since ssh uses a psuedo-terminal
@7shi
7shi / BitWriter.bas
Created April 13, 2012 14:20
VBA版Deflate
' public domain
Option Explicit
Private FOut%
Private buf() As Byte
Private bufp&, cur&, bit%
Public Sub BitWriter_Init(FO%)
ReDim buf(4095)
FOut = FO