Skip to content

Instantly share code, notes, and snippets.

"http://d.w10a.com/win11/Win11-Pro-X64-New.ISO",
"http://iso.winwin7xz.com/2024/new/WIN11_X64_V2024.iso",
"http://du.cainiaoxt.cn/dd.php/windows_10_professional_x64_2024.iso",
"http://download2.ew27.com/download2/bendi/C/CJWin11-64ZC.html",
"https://down.360safe.com/se/QuickMediaEditor_1.3.1.2043_Setup_1009_20231225_1838.exe",
"https://www.onlinedown.net/iopdfbhjl/530131?module=download&t=website&v=20240812201338",
"https://dldir1v6.qq.com/weixin/Windows/WeChatSetup.exe",
"https://xiuxiu.dl.meitu.com/pc_channel64/xiuxiu64_setup.exe",
"https://d1.music.126.net/dmusic/NeteaseCloudMusic_Music_official_3.0.0.202884_64.exe",
"https://dx2.890213.com/h/hongmaozilinuxzuixinbanbenredhat%20linux.zip",
@sjava
sjava / lesson_deref.md
Created August 6, 2024 07:06 — forked from Houtamelo/lesson_deref.md
Lesson - Deref

Introduction

This lesson aims to teach the reader about the inner-workings of Rust's *(deref operator) and trait Deref, as well as how to take advantage of those features.

Requirements

This lesson assumes that:

  • You have amateurish understanding of Rust's type system. Most importantly, understand that references are types, meaning &T, &mut T and T are all different types.

Terminology

@sjava
sjava / repo.ex
Created September 22, 2021 16:14 — forked from c4710n/repo.ex
Ecto: reverse a preload
defmodule Hello.Repo do
use Ecto.Repo,
otp_app: :hello,
adapter: Ecto.Adapters.Postgres
@doc """
Reverse a preload.
## Example
@sjava
sjava / cdma_pdu.py
Created December 30, 2019 09:27 — forked from sorz/cdma_pdu.py
Decode SMS from CDMA PDU
from datetime import datetime
import binascii
import logging
import io
def _parse_fields(raw):
"""Return a iterators of (id, value)."""
raw = io.BytesIO(raw)
while True:
@sjava
sjava / networkmanager-wifi-powersave.md
Created July 15, 2019 02:11 — forked from jcberthon/networkmanager-wifi-powersave.md
NetworkManager Wi-Fi powersaving configuration

NetworkManager WiFi Power Saving

NetworkManager supports WiFi powersaving but the function is rather undocumented.

From the source code: wifi.powersave can have the following value:

  • NM_SETTING_WIRELESS_POWERSAVE_DEFAULT (0): use the default value
  • NM_SETTING_WIRELESS_POWERSAVE_IGNORE (1): don't touch existing setting
  • NM_SETTING_WIRELESS_POWERSAVE_DISABLE (2): disable powersave
@sjava
sjava / album.ex
Created March 12, 2019 14:30
scroll happend error
defmodule MyappWeb.AlbumController do
use MyappWeb, :controller
use Filterable.Phoenix.Controller
import ShorterMaps
alias Myapp.Accounts
alias Myapp.Accounts.Album
action_fallback(MyappWeb.FallbackController)
filterable(Myapp.AlbumFilters)
@sjava
sjava / Dockerfile
Created November 1, 2018 03:17
docker-for-phoenix
FROM elixir:1.6.5
ENV NODE_VERSION 8.x
ENV NPM_VERSION 6.1.0
ENV PHOENIX_VERSION 1.3.2
RUN curl -sL https://deb.nodesource.com/setup_${NODE_VERSION} | bash \
&& apt-get install -y nodejs
RUN npm install npm@${NPM_VERSION} -g
@sjava
sjava / convert_utf8_to_utf8mb4
Created September 25, 2018 16:21 — forked from dschneider/convert_utf8_to_utf8mb4
How to easily convert utf8 tables to utf8mb4 in MySQL 5.5
# For each database:
ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
# For each table:
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
# For each column:
ALTER TABLE table_name CHANGE column_name column_name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
# (Don’t blindly copy-paste this! The exact statement depends on the column type, maximum length, and other properties. The above line is just an example for a `VARCHAR` column.)
@sjava
sjava / xmerl_demo.ex
Created August 5, 2018 16:01 — forked from sasa1977/xmerl_demo.ex
Simple xmerl usage demo in Elixir
defmodule XmlNode do
require Record
Record.defrecord :xmlAttribute, Record.extract(:xmlAttribute, from_lib: "xmerl/include/xmerl.hrl")
Record.defrecord :xmlText, Record.extract(:xmlText, from_lib: "xmerl/include/xmerl.hrl")
def from_string(xml_string, options \\ [quiet: true]) do
{doc, []} =
xml_string
|> :binary.bin_to_list
|> :xmerl_scan.string(options)