Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
use Text::MicroTemplate::File;
my $info = qx{/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I};
my ($ssid) = $info =~ / SSID: (.*)$/m;
@rstacruz
rstacruz / index.md
Last active February 19, 2026 12:40
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@shunchu
shunchu / convert-seconds-into-hh-mm-ss-in-ruby.rb
Created July 25, 2012 07:58
Convert seconds into HH:MM:SS in Ruby
t = 236 # seconds
Time.at(t).utc.strftime("%H:%M:%S")
=> "00:03:56"
# Reference
# http://stackoverflow.com/questions/3963930/ruby-rails-how-to-convert-seconds-to-time
@STAR-ZERO
STAR-ZERO / gist:3413415
Created August 21, 2012 08:13
【Android】画像を縮小して読み込み、画像リサイズ
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
/**
* 画像変換クラス
*
*/
public class BitmapUtil {
@mollifier
mollifier / zshrc_useful.sh
Last active June 21, 2025 08:07
少し凝った zshrc
# 少し凝った zshrc
# License : MIT
# http://mollifier.mit-license.org/
########################################
# 環境変数
export LANG=ja_JP.UTF-8
# 色を使用出来るようにする
@numa08
numa08 / neo.java
Last active December 30, 2015 21:59
ねおさんへ♡
public enum FaceNameEye {
Mabataki("まばたき"),
Warai("笑い"),
Wink_L("ウインク"),
Wink_l2("ウインク2"),
final String name;
FaceNameEye(String name) {
this.name = name;
var w = {
width : 100,
height: 200,
center : function() {
return {
x : this.width /2,
y : this.height/2
};
}
};
@ybenjo
ybenjo / README.md
Last active December 13, 2023 08:04 — forked from yagays/agqr.rb
save AGQR radio programs.

agqr.rb

これは何

AGQR の放送を保存するスクリプト.

fork 元との違いは

yagays / agqr.rb には

  • 31日まである月に翌日の指定が失敗する

というバグが存在する.

@Namek
Namek / TagsLayersEnumBuilder.cs
Last active September 26, 2024 09:02
Tags and Layers Enums Builder for Unity3D
#if UNITY_EDITOR
using UnityEngine;
using System.Collections;
using UnityEditor;
using System;
using System.IO;
using System.Text;
public class TagsLayersEnumBuilder : EditorWindow {
[MenuItem("Edit/Rebuild Tags And Layers Enums")]
@tk3fftk
tk3fftk / hubot_google_calendar.coffee
Last active November 19, 2017 23:26
hubotに毎朝予定をお知らせしてもらう
fs = require('fs')
readline = require('readline')
google = require('googleapis')
googleAuth = require('google-auth-library')
calendar = google.calendar('v3')
SCOPES = [ 'https://www.googleapis.com/auth/calendar.readonly' ]
TOKEN_DIR = (process.env.HOME or process.env.HOMEPATH or process.env.USERPROFILE) + '/.credentials/'
TOKEN_PATH = TOKEN_DIR + 'calendar-api-quickstart.json'
# Create an OAuth2 client with the given credentials, and then execute the