Skip to content

Instantly share code, notes, and snippets.

@kiichi
kiichi / MyFileReader.java
Created July 6, 2019 15:06
Java IO Seek Example
import java.io.File;
import java.io.RandomAccessFile;
public class MyFileReader {
public static void main(String[] args) throws Exception {
File file = new File("bigfile.txt");
RandomAccessFile raf = new RandomAccessFile(file, "r");
long maxSize = 500000;
if(file.exists()){
long size = file.length();
@kiichi
kiichi / JavaScript_Snippets.md
Last active June 9, 2020 02:53
Javascript Tips

JavaScrip Snippets

Collection of JS tips and tricks

@kiichi
kiichi / AlaSQLInVue.vue
Last active December 14, 2021 02:07
Use alasql in Vue.js
<script>
export default {
mounted(){
this.alasql("CREATE TABLE cities (city string, population number)");
this.alasql("INSERT INTO cities VALUES ('Rome',2863223),('Paris',2249975),('Berlin',3517424),('Madrid',3041579)");
var res = this.alasql("SELECT * FROM cities WHERE population < 3500000 ORDER BY population DESC");
console.log(res);
}
}
</script>
@kiichi
kiichi / minerals.txt
Created September 1, 2017 04:34
List of Minerals extracted from Wikipedia
Allophane
Amethyst
Apophyllite
aquamarine
Arsenopyrite
Chihuahua
Aurichalcite
Austinite
Mapimí
Durango
@kiichi
kiichi / ListExample.cs
Created August 29, 2017 21:28
Manipulating List
using System;
using System.Collections.Generic;
// Need to link Microsoft.CSharp in reference
namespace MyPlayground {
class MainClass {
public static void Main(string[] args) {
var list = new List<dynamic>();
list.Add(new {
Text = "hello",
Value = "world"
@kiichi
kiichi / Jenkins_API_Memo.md
Last active July 8, 2017 21:45
Jenkins API Access Memo

How to retrieve API Key

  1. Click Username
  2. Click Configuration
  3. Show API Token Button
curl  -g http://myusername:[email protected]:8080/api/json?pretty=true
[Route("Upload/")]
[HttpPost]
public async Task<object> Upload(string fileName){
string path = Path.GetTempPath();
var provider = new MultipartFormDataStreamProvider(path);
await Request.Content.ReadAsMultipartAsync(provider);
var tmpFilePath = provider.FileData.Select(entry => entry.LocalFileName).First();
var targetFilePath = Path.Combine(@"C:\tmp\", fileName);
File.Copy(tmpFilePath,targetFilePath);
return fileName + " has been saved on " + targetFilePath + " via " + tmpFilePath;
@kiichi
kiichi / ibeacon.swift
Created May 26, 2017 07:47
iBeacon Example in Swift 3
import UIKit
import CoreLocation
class FirstViewController: UIViewController, CLLocationManagerDelegate {
var locationManager:CLLocationManager = CLLocationManager()
override func viewDidLoad() {
super.viewDidLoad()
locationManager.requestAlwaysAuthorization()
locationManager.delegate = self
let region:CLBeaconRegion = CLBeaconRegion(proximityUUID: UUID(uuidString:"2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6")!, identifier: "kiichi.test")
@kiichi
kiichi / ibeacon-example.ts
Created May 26, 2017 07:44
Ionic2 iBeacon Example
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { IBeacon } from '@ionic-native/ibeacon';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
@kiichi
kiichi / intersects_test.ipynb
Created June 8, 2016 14:35
Intersection using shapely and pyproj after projecting on Web Mercator
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.