Skip to content

Instantly share code, notes, and snippets.

View ahmadrosid's full-sized avatar
🚀
On

ahmadrosid ahmadrosid

🚀
On
View GitHub Profile
[Desktop Entry]
# The type as listed above
Type=Application
# The version of the desktop entry specification to which this file complies
Version=1.0
# The name of the application
@ahmadrosid
ahmadrosid / AndroidWifiIP.md
Last active October 17, 2019 17:51
Get Android WIFI ip address v4

On your manifest

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

Get android wifi ip address v4.

WifiManager wm = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE);
int ip = wm.getConnectionInfo().getIpAddress();
String ipv4 = String.format("%d.%d.%d.%d", (ip &amp; 0xff), (ip &gt;&gt; 8 &amp; 0xff), (ip &gt;&gt; 16 &amp; 0xff), (ip &gt;&gt; 24 &amp; 0xff));
package websocket;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.WebSocketListener;
import okio.ByteString;
import javax.sound.sampled.*;
import java.io.ByteArrayInputStream;
@ahmadrosid
ahmadrosid / scroll_lock.md
Created October 22, 2019 14:23
Activate scroll lock
xmodmap -e ‘add mod3 = Scroll_Lock’

PHP Script for generate the data.

<?php

$mappings = '{
    "mappings": {
      "_doc": {
        "properties": {
            "id": {"type": "integer"},
            "pipeline_id": {"type": "integer"},
-- phpMyAdmin SQL Dump
-- version 4.7.6
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Nov 26, 2019 at 01:26 PM
-- Server version: 8.0.16
-- PHP Version: 7.2.21
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";

Color references:

Reset = "\x1b[0m"
Bright = "\x1b[1m"
Dim = "\x1b[2m"
Underscore = "\x1b[4m"
Blink = "\x1b[5m"
Reverse = "\x1b[7m"
Hidden = "\x1b[8m"

Create Site :

curl -X POST \
  https://dev-kong.command-api.kw.com/mns/sites \
  -H 'Authorization: Bearer {{token_here}}' \
  -H 'Content-Type: application/json' \
  -d '{
    "data": {
        "attributes": {
@ahmadrosid
ahmadrosid / Activate Office 2019 for macOS VoL.md
Created December 16, 2019 15:08 — forked from zthxxx/Activate Office 2019 for macOS VoL.md
crack activate office on mac with license file

Activate MS Office 2019/2016 for macOS - Microsoft_Office_2019_VL_Serializer

Office 2019 above

2019-06-03

Note that Office2019 DO NOT support activate via simple copy/paste plist license file which is the simplest way to activate Office 2016. Fortunately, you can also use the VL Serializer tool, just install Office 2019 and Serializer, then run Serializer to activate.

Ref

@ahmadrosid
ahmadrosid / env.md
Created December 20, 2019 16:22
PHP super simple dotenv
function load_env()
{
	if ($fh = fopen('../.env', 'r')) {
	    while (!feof($fh)) {
	        $line = fgets($fh);
	        putenv($line);
	    }
	    fclose($fh);
	}