Skip to content

Instantly share code, notes, and snippets.

View YazzyYaz's full-sized avatar
💭
Coding 💻

Yaz Khoury YazzyYaz

💭
Coding 💻
View GitHub Profile
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@mschoebel
mschoebel / main.go
Created March 6, 2014 20:02
Snippet: login/logout (Golang)
package main
import (
"fmt"
"github.com/gorilla/mux"
"github.com/gorilla/securecookie"
"net/http"
)
// cookie handling
@azmenak
azmenak / gulpfile.js
Last active April 24, 2017 21:35
Example Gulpfile for Jekyll
var options, paths,
gulp = require("gulp"),
merge = require("merge-stream"),
path = require("path"),
clean = require("gulp-clean"),
concat = require("gulp-concat"),
markdown = require("gulp-markdown"),
minifyCSS = require("gulp-minify-css"),
removeLines = require("gulp-remove-lines"),
@garaud
garaud / sqlalchemy-orm-query-to-dataframe.py
Last active June 7, 2024 13:55
Example to turn your SQLAlchemy Query result object to a pandas DataFrame
# -*- coding: utf-8 -*-
"""From a Query.all(), turn this result to a pandas DataFrame
Table creation and example data come from the official SQLAlchemy ORM
tutorial at http://docs.sqlalchemy.org/en/latest/orm/tutorial.html
Just take a look at the 'query_to_dict' function and the last part of the __main__.
"""
Language Vehicle Reason
GoLang Tesla The future, but want somebody I know to buy one first
Haskell Batmobile Looks awesome but you'll never figure out how to drive it
Java Hummer Uses way more resources than is strictly necessary
Perl Classic Mini A classic that has influenced many cars, but not practical for 2015
PHP Fiat Multipla Ugly, nobody wants to be seen driving this
Ruby Smart Car Practical design. Will get you around the city fast, but not great on motorways
Python VW Golf Solid. Reliable. Middle of the road.
@sinclairtarget
sinclairtarget / bernoulli.c
Created August 17, 2018 20:22
Lovelace's Note G Program in C
#include <stdio.h>
/*
* Calculates what Ada Lovelace labeled "B7", which today we would call the 8th
* Bernoulli number.
*/
int main(int argc, char* argv[])
{
// ------------------------------------------------------------------------
// Data
with
double_entry_book as (
select
array_to_string(outputs.addresses,',') as address,
value, block_timestamp
from `crypto-etl-bitcoin-prod.bitcoin_blockchain.transactions` join unnest(outputs) as outputs
union all
select
array_to_string(inputs.addresses,',') as address,
-value as value, block_timestamp
SELECT
SUM (fees)
FROM (
SELECT
*,
eth * eth_price / 1e18 AS trade_volume,
eth * eth_price * 0.003 / 1e18 AS fees
FROM (
SELECT distinct
a.hash,
@haferman
haferman / celocli.txt
Created December 19, 2019 15:34
celo: celocli install for fresh Ubuntu 18.04 server
# install nodejs and dependencies
sudo apt -y install curl dirmngr apt-transport-https lsb-release ca-certificates
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash
sudo apt -y install gcc g++ make
sudo apt -y install nodejs
# install yarn
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
# check on node and npm versions (for me was 10.17.0 and 6.11.3)
@haferman
haferman / TLS-enable.txt
Last active December 9, 2021 01:35
steps to enable TLS for attestations
1. create DNS "A" record (link ip address with FQDN)
2. make sure port 443 is open
3. sudo apt install nginx
4. stop attestation-service (so we can get certificate on default port 80)
5. sudo systemctl start nginx
6. sudo systemctl enable nginx
7. https://certbot.eff.org/instructions?ws=nginx&os=ubuntubionic
(sudo snap install --classic certbot; sudo ln -s /snap/bin/certbot /usr/bin/certbot; sudo certbot --nginx)
8. sudo vi /etc/nginx/sites-available/default (doc root change to /dev/null so that http://ipaddress will fail)
9. attestation.config should point to new port (8080)