Skip to content

Instantly share code, notes, and snippets.

View websoftwares's full-sized avatar
🏠
Working from home

websoftwares

🏠
Working from home
  • Luxembourg
View GitHub Profile
@andykuszyk
andykuszyk / Setting up Cassandra for remote access.md
Last active October 31, 2023 07:48
Setting up Cassandra for remote access

Make these changes in the cassandra.yaml config file:

start_rpc: true

rpc_address: 0.0.0.0

broadcast_rpc_address: [node-ip]

listen_address: [node-ip]

@bkawk
bkawk / default
Created April 2, 2017 14:36
nginx reverse proxy with caching and SSL for IPFS
map $sent_http_content_type $expires {
default off;
text/html epoch;
text/css max;
application/javascript max;
~image/ max;
}
server {
listen 443 ssl http2 default_server;
@bgmort
bgmort / parseSignedRequest.js
Last active June 2, 2020 03:09 — forked from cyakimov/gist:1139981
Decode Facebook signed_request with NodeJS
// Fixed an error with character replacement, removed a dependency, included imports, throw errors, and fixed global variables
var crypto = require('crypto');
//remove a dependency on b64url
function atob(str) {
return new Buffer(str, 'base64').toString('binary');
}
//this is not used here, but to leave it out would be like passing the salt without the pepper.
function btoa(str) {
@gildas
gildas / promise-series.js
Created February 13, 2017 00:52
execute promises in series
// Promise returning functions to execute
function doFirstThing(){ return Promise.resolve(1); }
function doSecondThing(res){ return Promise.resolve(res + 1); }
function doThirdThing(res){ return Promise.resolve(res + 2); }
function lastThing(res){ console.log("result:", res); }
var fnlist = [ doFirstThing, doSecondThing, doThirdThing, lastThing];
// Execute a list of Promise return functions in series
function pseries(list) {
@bittner
bittner / 60-jetbrains.conf
Created September 25, 2015 07:57
Inotify configuration for IntelliJ IDEA (PhpStorm, PyCharm, RubyMine, WebStorm). Create this file with e.g. `sudo vim /etc/sysctl.d/60-jetbrains.conf`
# Set inotify watch limit high enough for IntelliJ IDEA (PhpStorm, PyCharm, RubyMine, WebStorm).
# Create this file as /etc/sysctl.d/60-jetbrains.conf (Debian, Ubuntu), and
# run `sudo service procps start` or reboot.
# Source: https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit
#
# More information resources:
# -$ man inotify # manpage
# -$ man sysctl.conf # manpage
# -$ cat /proc/sys/fs/inotify/max_user_watches # print current value in use
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active June 1, 2024 09:44
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@sebmarkbage
sebmarkbage / Enhance.js
Last active January 31, 2024 18:33
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@marc0der
marc0der / gist:6015948
Last active May 24, 2022 10:06
Higher order function in bash!
#!/bin/bash
function printit {
echo "This is from an embedded function: $1"
}
function printthat {
echo "This is the first line."
$1 $2
echo "This is the third line."
@codler
codler / gist:3906826
Created October 17, 2012 17:18
Support HTTP Header Range, mp4, php.php/mp4.mp4
<?php
# Nginx don't have PATH_INFO
if (!isset($_SERVER['PATH_INFO'])) {
$_SERVER['PATH_INFO'] = substr($_SERVER["ORIG_SCRIPT_FILENAME"], strlen($_SERVER["SCRIPT_FILENAME"]));
}
$request = substr($_SERVER['PATH_INFO'], 1);
$file = $request;
$fp = @fopen($file, 'rb');
@adhipg
adhipg / countries.sql
Created January 12, 2012 11:41
Sql dump of all the Countries, Country Codes, Phone codes.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;