Skip to content

Instantly share code, notes, and snippets.

namespace LIB;
/**
* FileUtils class.
*
* Contains utility functions for dealing with files or the filesystem.
*/
class FileUtils
{
/**
@kian
kian / long2ip.c
Last active July 28, 2016 01:58
Programming exercises
/**
* long2ip
*/
#include <stdio.h>
int main()
{
int ip = 0b01111111000000000000000000000001; // dotted-quad 127.0.0.1 (for visualizing)
int a, b, c, d;
int mask = 0xFF;
@kian
kian / gist:9471788
Created March 10, 2014 18:54
sesesef
sefseffse

Keybase proof

I hereby claim:

  • I am kian on github.
  • I am kian (https://keybase.io/kian) on keybase.
  • I have a public key whose fingerprint is C2C9 5CA4 7A06 D3E5 305E 9391 68DD 9D24 7C8E A90C

To claim this, I am signing this object:

kian at zergtrap in ~/dev/tftest (arcpatch-D35_1●●)
$ tree
.
├── barmodule
│   └── main.tf
├── foomodule
│   └── main.tf
└── test.tf
2 directories, 3 files
###
### start nginx container with syslog driver
###
[ec2-user@ip-172-31-48-33 ~]$ sudo docker run -d --name testing2 -P --log-driver=syslog nginx
eef985214f466aaa84c4d969c8843c00ff13e38ecbf4377519c1a15290e6a4d0
[ec2-user@ip-172-31-48-33 ~]$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
eef985214f46 nginx "nginx -g 'daemon of 7 seconds ago Up 6 seconds 0.0.0.0:32770->80/tcp, 0.0.0.0:32769->443/tcp testing2
@kian
kian / foo.php
Last active January 21, 2016 20:26
--omg-optimized
<?php
private function predictQualityForFilesize($width, $height, $bytes)
{
/*
* There's apparently some overhead in the JPEG file format that
* scales with the square root of the file's size. Accounting for it
* causes the bpp-to-quality curves for the different dimensions to
* line up better.
*
<script>
// BEAT MESSAGE
try {
window.wixBiSession = {
initialTimestamp : Date.now(),
viewerSessionId: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c)
{ var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); return v.toString(16); }
)
};
(new Image()).src = 'http://frog.wix.com/bt?src=29&evid=3&pn=1&et=1&v=3.0&vsi=' + wixBiSession.viewerSessionId +
dependencies:
override:
- sudo -H pip install awsebcli --upgrade --ignore-installed
test:
override:
- echo 'we run the tests after deploy'
deployment:
stage:
kian@zergtrap ~/src/puppet-placelocal $ yarn add user-home
yarn add v0.15.1
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 2 new dependencies.
├─ os-homedir@1.0.2