Skip to content

Instantly share code, notes, and snippets.

Hasan Tayyar BEŞİK hasantayyar

Block or report user

Report or block hasantayyar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@munificent
munificent / generate.c
Last active Oct 23, 2019
A random dungeon generator that fits on a business card
View generate.c
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u
View btc_price_check_cronjob.sh
### your_cronjob.sh ####
btc=$(curl -s http://api.coindesk.com/v1/bpi/currentprice.json | python -c "import json, sys; print(int(json.load(sys.stdin)['bpi']['USD']['rate'].replace(',','').split('.')[0] ))")
ALERT_BTC=3000
if [ $(($btc + 1)) -gt $ALERT_BTC ];
then
echo "btc is greater than $ALERT_BTC";
push "BTC value is greater then $ALERT_BTC"
fi;
@eiriklv
eiriklv / avoiding-exceptions.js
Last active Feb 2, 2019
Exception free JavaScript?
View avoiding-exceptions.js
/**
* WHY? - BECAUSE EXCEPTIONS/TRY/CATCH IS A GLOBAL HORRIBLE MESS :-(
* Check out error handling in golang: https://blog.golang.org/error-handling-and-go
*/
/**
* Wrap an "unsafe" promise
*/
function safePromise(promise) {
return promise
@wearhere
wearhere / deploy_aws.sh
Created Oct 16, 2016
CI script to convert a Meteor application into a Node.js application then deploy it to AWS Elastic Beanstalk.
View deploy_aws.sh
#!/bin/bash
#
# This script will convert a Meteor application into a Node.js application
# then deploy it to AWS Elastic Beanstalk.
#
# Run like `deploy_aws.sh my_eb_app my_eb_app-production`.
#
# That will deploy the Meteor application containing this script
# to the `my_eb_app-production` environment of the `my_eb_app` EB application.
View sudo.py
import sys, marshal, functools, subprocess
child_script = """
import marshal, sys, types;
fn, args, kwargs = marshal.load(sys.stdin)
marshal.dump(
types.FunctionType(fn, globals())(*args, **kwargs),
sys.stdout)
"""
@bastman
bastman / docker-cleanup-resources.md
Created Mar 31, 2016
docker cleanup guide: containers, images, volumes, networks
View docker-cleanup-resources.md

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
@mauvm
mauvm / Jasmine-and-Babel6.md
Created Nov 12, 2015
Jasmine ES6 run script for use with Babel 6
View Jasmine-and-Babel6.md
$ npm install --save babel-cli babel-preset-es2015
$ npm install --save-dev jasmine

.babelrc:

{
  "presets": ["es2015"]
@gene1wood
gene1wood / all_aws_managed_policies.json
Last active Nov 13, 2019
A list of all AWS managed policies and they're policy documents as well as a short script to generate the list
View all_aws_managed_policies.json
{
"APIGatewayServiceRolePolicy": {
"Arn": "arn:aws:iam::aws:policy/aws-service-role/APIGatewayServiceRolePolicy",
"AttachmentCount": 1,
"CreateDate": "2018-08-10T17:57:44+00:00",
"DefaultVersionId": "v3",
"Document": {
"Statement": [
{
"Action": [
@hasantayyar
hasantayyar / s32logentries.py
Created Nov 5, 2015
s3 to logentries aws lamda script
View s32logentries.py
import json
import urllib
import boto3
import httplib
import re
import json
addr = '/%s/hosts/%s/%s?realtime=1' % ("accountkey","hostkey","logkey")
print('Loading function')
@rupey
rupey / mandelbrot.sql
Last active Jan 12, 2019
Mandelbrot plot in postgres
View mandelbrot.sql
WITH RECURSIVE
x(i) AS ( VALUES (0)
UNION ALL SELECT i + 1
FROM x
WHERE i < 101),
Z(Ix, Iy, Cx, Cy, X, Y, I) AS (
SELECT
Ix,
Iy,
X :: FLOAT,
You can’t perform that action at this time.