Skip to content

Instantly share code, notes, and snippets.

Avatar
🚧
WIP

Bayu Aldi Yansyah pyk

🚧
WIP
View GitHub Profile
@ryderdamen
ryderdamen / gce-to-gcs-uploads.md
Created Dec 4, 2018
Uploading Files from Google Compute Engine (GCE) VMs to Google Cloud Storage (GCS)
View gce-to-gcs-uploads.md

Uploading Files from Google Compute Engine (GCE) VMs to Google Cloud Storage (GCS)

I had a bit of trouble trying to configure permissions to upload files from my Google Compute Engine instance to my Google Cloud Storage bucket. The process isn't as intuitive as you think. There are a few permissions issues that need to be configured before this can happen. Here are the steps I took to get things working.

Let's say you want to upload yourfile.txt to a GCS bucket from your virtual machine. You can use the gsutil command line tool that comes installed on all GCE instances.

If you've never used the gcloud or gsutil command line tools on this machine before, you will need to initialize them with a service account.

@ligurio
ligurio / pledge_unveil_support.md
Last active Jul 13, 2020
Support of OpenBSD pledge(2) and unveil(2) in programming languages
@barosl
barosl / add.c
Created Jul 26, 2015
Function overloading in C
View add.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int addi(int a, int b) {
return a + b;
}
char *adds(char *a, char *b) {
char *res = malloc(strlen(a) + strlen(b) + 1);
@ImJasonH
ImJasonH / markdown.css
Last active Oct 19, 2020
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
View markdown.css
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@netpoetica
netpoetica / gnuplot-requests-per-ms
Last active Aug 29, 2015
gnuplot script for web requests / time
View gnuplot-requests-per-ms
#!/bin/sh
# RESOURCES:
# Blog - http://www.gnuplotting.org/
# Blog - http://gnuplot-surprising.blogspot.com/
# Colors, Line Types - http://kunak.phsx.ku.edu/~sergei/Gnuplot/line_point_types.html
# Linespoints - http://www.gnuplotting.org/tag/linespoints/
# Gnuplot and ab - http://www.bradlanders.com/2013/04/15/apache-bench-and-gnuplot-youre-probably-doing-it-wrong/
gnuplot << EOF
reset
@Jogan
Jogan / FloatingActionButton.java
Last active Feb 18, 2020
Implementation of Android L's floating action button pattern. API 14+
View FloatingActionButton.java
package your_package;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
@christopher-hopper
christopher-hopper / vm-resize-hard-disk.md
Last active Sep 20, 2020
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.
View vm-resize-hard-disk.md

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

@peterc
peterc / methods_returning.rb
Last active Aug 14, 2017
Object#methods_returning - to work out which method on an object returns what we want
View methods_returning.rb
require 'stringio'
require 'timeout'
class Object
def methods_returning(expected, *args, &blk)
old_stdout = $>
$> = StringIO.new
methods.select do |meth|
Timeout::timeout(1) { dup.public_send(meth, *args, &blk) == expected rescue false } rescue false
@pyk
pyk / active-record-migration-expert.md
Last active Dec 3, 2019
become active record migration expert (Rails 4.0.2)
View active-record-migration-expert.md

become active record migration expert (Rails 4.0.2)

workflow:

create model

$ rails g model NameOfModel
    invoke  active_record
    create    db/migrate/YYYYMMDDHHMMSS_create_name_of_models.rb
@debasishg
debasishg / gist:8172796
Last active Nov 20, 2020
A collection of links for streaming algorithms and data structures
View gist:8172796
  1. General Background and Overview
You can’t perform that action at this time.