Skip to content

Instantly share code, notes, and snippets.

View indrakaw's full-sized avatar
🎯
Focusing

Indra Kurniawan indrakaw

🎯
Focusing
  • Slow Code, co.
  • Cirebon, Indonesia
View GitHub Profile
@qti3e
qti3e / README.md
Last active April 13, 2024 15:50
List of file signatures and mime types based on file extensions
@ivanvermeyen
ivanvermeyen / !NOTE.md
Last active March 15, 2023 05:25
Setup a Laravel Storage driver with Google Drive API
@nicksantamaria
nicksantamaria / fork-example.php
Created October 20, 2016 22:35
Example: Parallel processing in PHP using pcntl_fork()
<?php
/**
* @file
* Basic demonstration of how to do parallel threads in PHP.
*/
// This array of "tasks" could be anything. For demonstration purposes
// these are just strings, but they could be a callback, class or
// include file (hell, even code-as-a-string to pass to eval()).
@thegitfather
thegitfather / vanilla-js-cheatsheet.md
Last active May 22, 2024 07:37
Vanilla JavaScript Quick Reference / Cheatsheet
@b0bbywan
b0bbywan / .gitlab-ci.yml
Created February 4, 2016 11:33
Build and Deploy a javascript app with Gitlab-Ci
image: node:argon
before_script:
- apt-get -qq update
- apt-get -qq install -y python2.7 python2.7-dev build-essential make gcc g++ libicu-dev
- npm -g install npm --silent
- "echo -e \"export default {CLIENT_ID: '$CLIENT_ID'}\" > app/scripts/settings.js"
- npm set progress=false
- npm install --silent
@leommoore
leommoore / file_magic_numbers.md
Last active May 22, 2024 22:42
File Magic Numbers

File Magic Numbers

Magic numbers are the first bits of a file which uniquely identify the type of file. This makes programming easier because complicated file structures need not be searched in order to identify the file type.

For example, a jpeg file starts with ffd8 ffe0 0010 4a46 4946 0001 0101 0047 ......JFIF.....G ffd8 shows that it's a JPEG file, and ffe0 identify a JFIF type structure. There is an ascii encoding of "JFIF" which comes after a length code, but that is not necessary in order to identify the file. The first 4 bytes do that uniquely.

This gives an ongoing list of file-type magic numbers.

Image Files

@domenic
domenic / 0-github-actions.md
Last active April 8, 2024 23:35
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
@kosinix
kosinix / resumable-download.php
Created September 22, 2014 08:46
PHP - resumable download
<?php
class ResumeDownload {
private $file;
private $name;
private $boundary;
private $delay = 0;
private $size = 0;
function __construct($file, $delay = 0) {
if (! is_file($file)) {
@ken47
ken47 / gist:3870213
Created October 11, 2012 04:41
single-layer perceptron in Octave / Matlab
function perceptron0 = perceptron(numPoints, runs)
iters = 0;
for i = 1:runs
errors = 2;
points = genPoints(numPoints);
gWeights = [0 0 0];
[fWeights,a,b] = genTarget;
while errors > 0
errors = 0;
@digitaljhelms
digitaljhelms / api.json
Created July 13, 2012 23:44
A JSON formatted response containing all posts from a Jekyll blog
[
{
"homepage": "http://digitaljhelms.github.com",
"name": "digitaljhelms",
"description": "finally blogging...",
"author": "Jeremy Helms",
"post": {
"url": "http://digitaljhelms.github.com/howto/creating-a-branch-with-no-parents-or-history",
"slug": "creating-a-branch-with-no-parents-or-history",
"title": "Create a Git Branch without Parents or History",