Skip to content

Instantly share code, notes, and snippets.

View cincauhangus's full-sized avatar
🎯
Actually working

Aaron Ho cincauhangus

🎯
Actually working
  • Kuala Lumpur, Malaysia
  • 21:11 (UTC +08:00)
View GitHub Profile
@cincauhangus
cincauhangus / allocation.sql
Last active February 26, 2024 09:04
$DEGEN Airdrop 2 Tip Allocations & Leaderboard Dune Queries
WITH date_series AS (
SELECT
DATE_TRUNC( 'day', CAST(day AS DATE) ) AS event_day
FROM
UNNEST(
sequence(
CAST('2021-09-23' AS DATE),
CURRENT_DATE,
INTERVAL '1' DAY
)
@cincauhangus
cincauhangus / setfacl.sh
Last active May 11, 2020 10:28
Setting file permissions for apache (centos/redhat)
# current permission should be the current user (e.g. ec2-user).
# we assume apache group exists, otherwise change the group name appropriately
# links: https://www.linuxquestions.org/questions/linux-desktop-74/applying-default-permissions-for-newly-created-files-within-a-specific-folder-605129/
# all commands should be run with sudo/as root.
# sets new files to inherit group permissions
# chmod g+s
# set permissions to files
# find . -type f -exec setfacl -m group:apache:6 {} \;
@cincauhangus
cincauhangus / linq.vb
Created July 27, 2017 06:43
SQL to LINQ String Comparison
Dim value = "F!NDM3"
' strColumn LIKE '%F!NDM3%'
Dim results1 = (From row In table Where row.strColumn.Contains(value) Select row.id)
' strColumn LIKE 'F!NDM3%'
Dim results2 = (From row In table Where row.strColumn.StartsWith(value) Select row.id)
' strColumn LIKE '%F!NDM3'
Dim results3 = (From row In table Where row.strColumn.EndsWith(value) Select row.id)
' strColumn LIKE 'F!NDM3'
Dim results4 = (From row In table Where System.Data.Linq.SqlClient.SqlMethods.Like(row.strColumn, value) Select row.id)
@cincauhangus
cincauhangus / Linq.to.SQL.vb
Created December 28, 2016 06:13
Linq to SQL Conversions
Dim value = "F!NDM3"
' strColumn LIKE '%F!NDM3%'
Dim results1 = (From row In table Where row.strColumn.Contains(value) Select id)
' strColumn LIKE 'F!NDM3%'
Dim results2 = (From row In table Where row.strColumn.StartsWith(value) Select id)
' strColumn LIKE '%F!NDM3'
Dim results3 = (From row In table Where row.strColumn.EndsWith(value) Select id)
' strColumn LIKE 'F!NDM3'
Dim results4 = (From row In table Where System.Data.Linq.SqlClient.SqlMethods.Like(row.strColumn, value) Select id)
{"maps":{"id1421662915257":{"label":"Farms","state":1,"bkmrk":{"id1421662923442":{"label":"Ativo","latlng":"3.196494,101.616722","z":17},"id1421663058720":{"label":"Bukit Jalil","latlng":"3.054583,101.673639","z":18},"id1421662945980":{"label":"Damansara Utama","latlng":"3.134769,101.62317","z":17},"id1421663111552":{"label":"IOI Boulevard","latlng":"3.046185,101.621789","z":19},"id1421663955429":{"label":"Jaya One","latlng":"3.117597,101.635562","z":19},"id1421662978825":{"label":"MBPJ","latlng":"3.099322,101.645492","z":18},"id1421663755905":{"label":"Pudu Ulu","latlng":"3.124495,101.733549","z":17},"id1421663375584":{"label":"Telawi","latlng":"3.131295,101.671681","z":18},"id1421663028175":{"label":"Thean Hou","latlng":"3.121724,101.687849","z":19}}},"id1421663072922":{"label":"Clusters","state":1,"bkmrk":{"id1421663217419":{"label":"1 Utama","latlng":"3.148877,101.616197","z":17},"id1421663281381":{"label":"Brickfields","latlng":"3.129193,101.6875","z":16},"id1421663554409":{"label":"Bukit Bintang/KLCC","
@cincauhangus
cincauhangus / Ingress FAQ
Last active August 29, 2015 14:06
Ingress Frequently Asked Questions
Q: How do I walk in this game?
A: By getting out of your chair by foot.
Q: What do I get by successfully discovered a new portal?
A: You gain 1000 AP and +1 to your Seer, Pioneer and Explorer stats.
Q: The portal's image is ugly. Can I change the portal's photo to something better?
A: Yes, click on the portal's image, and click on edit and submit a new photo. Each accepted submission will gain you 500 AP
Q: The portal location is not in the right place, or the portal name/description is wrong. Can I change it?
@cincauhangus
cincauhangus / console.js
Last active January 3, 2016 02:29
Clicking Bad Click ScriptHack
// 1. paste this code into console
// 2. type makeItHappen(1000, true, true) to start
// 3. type makeItStop() to stop at any time
function makeItStop () {
proceed = false;
}
function makeItHappen (clickTimes, make, sell, clickDelay) {
@cincauhangus
cincauhangus / Example - CTE
Last active December 28, 2015 02:09
SQL Performance Tuning
USE [AdventureWorks2012]
GO
--#1
--Return the LoginID and Hire Date column from the HumanResource.Employee table
--For Employees who are Sales People
--HINT: Use BusinessEntityID to join to the Sales.SalesPerson table
--only include Sales people who actually sold something in the last year
--Sort the result by Hire Date
--what type of join did you use?
@cincauhangus
cincauhangus / v1.js
Last active December 15, 2015 05:49
Bookmarklet to log ExtJS events
//<a href="javascript:[ABSTRACT FUNCTION]">Log all Ext events</a>
//////// Version 1
(function () {
var a, l, o = (Ext ? Ext.util.Observable.prototype : false);
if (!o) {
alert('Ext not in page');
return;
}
@cincauhangus
cincauhangus / cdiff.pl
Created January 12, 2012 09:19
Colored Diff
#!/usr/bin/env perl
# a simple modification of the Diff implementation
use Term::ANSIColor qw(:constants);
$Term::ANSIColor::AUTORESET = 1;
die "usage: cdiff file1 file2\n" unless (@ARGV == 2);
open DIFF, "diff $ARGV[0] $ARGV[1] |" || die ($!);